<?php
require_once ("class_managed_table.php");
require_once ('class_layout.php');

class ManagedTablePage extends ManagedTable
{
  public $layout;

  public function __construct($title, $table, $primaryKey, $database = NULL)
  {
    $this->layout = new Layout($title);
    $this->layout->attachStylesheet(HTTP_COMMON . 'style-dropmenu.css');
    $this->layout->attachStylesheet(HTTP_COMMON . 'style-table.css');
    $this->layout->attachJavascript(HTTP_COMMON . 'javascript-dropmenu.js');
    $this->layout->attachJavascript(HTTP_COMMON . 'javascript-table.js');

    parent::__construct($table, $primaryKey, $database);
  }

  public function show()
  {
    parent::validateInput();
    if ($this->searchValue) {
      $this->layout->addBreadcrumb($this->layout->title, $_SERVER['PHP_SELF']);
      $this->layout->lastBreadcrumb = 'Search Results';
    }
    $this->layout->showHeader();
    parent::show();
    $this->layout->showFooter();
  }
}
?>